<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php
include ("../../include/dbFunctions.php");
include ("../../include/image_slider.php");
include ("../../include/function.php");
//Select sponsor
$sponsor = "SELECT sponsor_id, sponsor_name FROM sponsor";
$sponsor = executeSelectQuery($sponsor);
//select education level into array
$education_array = array();
$edu = "SELECT education_name FROM education";
$edu = executeSelectQuery($edu);
for ($i = 0; $i < count($edu); $i++) {
    $education_array[] = $edu[$i];
}
//select location into array
$location_array = array();
$loc = "SELECT location_name FROM location";
$loc = executeSelectQuery($loc);
for ($i = 0; $i < count($loc); $i++) {
    $location_array[] = $loc[$i];
}
?>

<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Junior Achievement Singapore</title>
        <link href="../../media/css/styles.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" language="javascript" src="../../media/js/jquery/jquery-1.6.1.min.js"></script>
        <script type="text/javascript" src="../../media/js/jquery/image_slider.js"></script>
        <script src="../../media/js/jq uery/custom_jquery.js" type="text/javascript"></script>
        <script type="text/javascript" src="../../media/js/jquery/jquery.form.js"></script>
        <script type="text/javascript" src="../../media/js/jquery/jquery.validate.min.js"></script>

        <!-- Custom jquery scripts -->
        <script src="../../media/js/jquery/custom_jquery.js" type="text/javascript"></script>
        <script type="text/javascript" src="../../media/js/jquery/validator_rules.js"></script>


        <script src="../..media/js/jquery/jquery.pngFix.pack.js" type="text/javascript"></script>
        <script type="text/javascript" charset="utf-8">
            $(document).ready(function() {
                $("#volunteer_form").validate(volunteer_validate);

            } );
            function toggle2(source) { //for select all checkbox :)
                checkboxes = document.getElementsByName('education[]');
                for each(var checkbox in checkboxes)
                checkbox.checked = source.checked;
            }

            function toggle3(source) { //for select all checkbox :)
                checkboxes = document.getElementsByName('location[]');
                for each(var checkbox in checkboxes)
                checkbox.checked = source.checked;
            }
        </script>
    </head>
    <body>
        <script>
            var timeout    = 700;
            var closetimer = 0;
            var ddmenuitem = 0;

            function jsddm_open()
            {  jsddm_canceltimer();
                jsddm_close();
                ddmenuitem = $(this).find('ul').css('visibility', 'visible');}

            function jsddm_close()
            {  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

            function jsddm_timer()
            {  closetimer = window.setTimeout(jsddm_close, timeout);}

            function jsddm_canceltimer()
            {  if(closetimer)
                {  window.clearTimeout(closetimer);
                    closetimer = null;}}

            $(document).ready(function()
            {  $('#navigation > li').bind('mouseover', jsddm_open)
                $('#navigation > li').bind('mouseout',  jsddm_timer)});

            document.onclick = jsddm_close;

        </script>
        <div id="container"><!--CONTAINER STARTS-->
            <div id="navigation">
                <li><a href="../../include/home/homepage.php">HOME</a></li>
                <li><a href="../../include/home/contact.php">CONTACT</a></li>
                <li><a href="http://ja.org.sg/">ABOUT JA SINGAPORE</a></li>
                <li><a href="http://jascheduling.lefora.com/">FEEDBACK</a></li>
                <li><a href="../../guide/guide_menu.php">HELP</a></li>

            </div>

            <div id="title"><!--TITLE STARTS-->
            </div><!--TITLE ENDS-->



            <div id="featured"><!--FEATURED AREA STARTS-->

                <div class="featured-image"><!--FEATURED IMAGE STARTS-->
                    <img alt="Featured Image" src="../../media/images/featured_image.png"></img>

                </div><!--FEATURED IMAGE ENDS-->

                <div class="featured-text"><!--FEATURED TEXT STARTS-->

                    <h2>Welcome to JA Singapore</h2>
                    <p>Junior Achievement programs help prepare young people for the real world by showing them how to generate wealth and effectively manage it, how to create jobs which make their communities more robust, and how to apply entrepreneurial thinking to the workplace. <a href="http://www.jaworldwide.org/">Read More... </a></p>

                </div><!--FEATURED TEXT ENDS-->

            </div><!--FEATURED AREA ENDS-->

            <?php
            custom_login();
            ?>


            <div id="left-content"><!--RIGHT CONTENT STARTS-->

                <div class="left-top"><!--RIGHT CONTENT BOX TOP-->
                </div><!--RIGHT CONTENT BOX TOP ENDS-->

                <div class="left-middle"><!--RIGHT CONTENT BOX MIDDLE-->

                    <form id="volunteer_form" method="post" action="volunteerVerifyRegistration.php" enctype="multipart/form-data">
                        <table border="0" cellpadding="0" cellspacing="0"  id="id-form">
                            <tr>
                                <em>* Required fields</em>
                            </tr><br></br>
                            <tr>
                                <th valign="top">Salutation <em>*</em> </th>
                                <td> <select name="volunteer_salutation" class="styledselect_form_1">
                                        <option value="Mr.">Mr.</option>
                                        <option value="Mrs.">Mrs.</option>
                                        <option value="Ms.">Ms.</option>
                                        <option value="Dr.">Dr.</option>
                                    </select></td>
                            </tr>
                            <tr>
                                <th valign="top"> First Name <em>*</em></th>
                                <td><input type="text" name="volunteer_firstname" value="" class="inp-form"/></td>
                                <td></td>
                            </tr>
                            <tr>
                                <th valign="top"> Family Name <em>*</em></th>
                                <td><input type="text" name="volunteer_surname" value="" class="inp-form"/></td>
                                <td></td>
                            </tr>
                            <tr>
                                <th valign="top">Gender <em>*</em> </th>
                                <td> <select name="volunteer_gender" class="styledselect_form_1">
                                        <option value="Male">Male</option>
                                        <option value="Female">Female</option>
                                    </select></td>
                            </tr>
                            <tr>
                                <th valign="top">Organization <em>*</em> </th>
                                <td> <select name="sponsor_id" class="styledselect_form_1">
                                        <?php
                                        for ($i = 0; $i < count($sponsor); $i++) {
                                            ?>
                                        <option value="<?php echo $sponsor[$i]['sponsor_id'] ?>"><?php echo $sponsor[$i]['sponsor_name'] ?></option>
                                            <?php
                                        }
                                        ?>
                                        <option value ="Other"> Other </option>
                                    </select><br></br>
                                </td>
                                <td></td>
                            </tr>
                            <tr>
                                <th valign="top">Profession <em>*</em></th>
                                <td><input type="text" name="volunteer_profession" value="" class="inp-form"/></td>
                                <td></td>
                            </tr>
                            <tr>
                                <th valign="top">Years of working <em>*</em></th>
                                <td><input type="text" name="volunteer_experience" value="" class="inp-form"/></td>
                                <td></td>
                            </tr>
                            <tr>
                                <th valign="top">Upload your CV </th>
                                <td><input type="file" name="uploadfile" id="file" /> </td>
                            </tr>
                            <tr>
                                <th valign="top">Mobile Phone <em>*</em></th>
                                <td><input type="text" name="volunteer_mobile" value="" class="inp-form"/></td>
                                <td></td>
                            </tr>
                            <tr>
                                <th valign="top">Office Phone </th>
                                <td><input type="text" name="volunteer_office" value="" class="inp-form"/><br></br></td>
                                <td></td>
                            </tr>
                            <tr>
                                <th valign="top">Preferred Educational Level<em>*</em></th>
                                <td>
                                    <?php
                                    for ($i = 0; $i < count($education_array); $i++) {
                                        ?>
                                    <input  type="checkbox" checked ="checked" name ="education[]"  class="" value="<?php echo $i ?>"/> <?php echo $education_array[$i]['education_name'] ?><br>
                                            <?php
                                        }
                                        ?>

                                </td>
                            </tr>
                            <tr>
                                <th valign="top">Preferred Time <em>*</em> </th>
                                <td><select name="preferred_timeslot" class="styledselect_form_1">
                                        <option value="0">Weekday</option>
                                        <option value="1">Weekend</option>
                                        <option value="2">No preference</option>
                                    </select>
                                </td>
                            </tr>

                        </table>


                        <table id="id-form">
                            <tr>
                                <th valign="top">Preferred Location <em>*</em><INPUT type="button" value="" class="form-help" onClick="window.open('../../include/singaporeArea.php','mywindow','width=520,height=340')"></th>
                                <td>
                                    <br></br>
                                    <?php
                                    for ($i = 0; $i < count($location_array); $i++) {
                                        ?>
                                    <input class="" type="checkbox" checked="checked" name ="location[]" value="<?php echo $i ?>"/> <?php echo $location_array[$i]['location_name'] ?><br></br>
                                        <?php
                                    }
                                    ?>

                                </td>
                            </tr>
                            <tr>
                                <th valign="top">How do you know about JA ? <em>*</em></th>
                                <td><textarea cols="30" rows="5" wrap="hard" name ="volunteer_reference"></textarea></td>
                                <td></td>
                            </tr>

                        </table>
                        <h4>Account information: </h4>
                        <br>
                            <table id="id-form">
                                <tr>
                                    <th valign="top">Email <em>*</em></th>
                                    <td><input type="text" name="volunteer_email" value="" class="inp-form"/></td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <th valign="top">Password <em>*</em> </th>
                                    <td><input type="password" name="volunteer_password" value="" id ="volunteer_password" class="inp-form"/></td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <th valign="top">Re-type Password <em>*</em> </th>
                                    <td><input type="password" name="volunteer_retype_password" value="" class="inp-form"/><br></br><br></br></td>
                                    <td></td>
                                </tr>

                            </table>
                            <input type="hidden" name="form_submitted" value="1"/>
                            <input type="submit" value="" name="submit"  class="form-submit"/>
                    </form>

                </div><!--RIGHT CONTENT BOX MIDDLE ENDS-->

                <div class="left-bottom"><!--RIGHT CONTENT BOX BOTTOM-->
                </div><!--RIGHT CONTENT BOX BOTTOM ENDS-->

            </div><!--RIGHT CONTENT ENDS-->



        </div><!--CONTAINER ENDS-->


        <div id="footer"><!--FOOTER STARTS-->
            <p>Copyright &copy; Junior Achievement Singapore | All Rights Reserved</p>
        </div><!--FOOTER ENDS-->

    </body>
</html>
